package sketch.ounit.fuzz;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class RandomFuzzExtractorTest extends TestCase {

	public static Test suite() {
		return new TestSuite(RandomFuzzExtractorTest.class);
	}
	
	public void testRandomFuzzIncorrectPlace1() {
		String file_path = "./testfiles/sketch/ounit/fuzz/IncorrectFuzz.java";
		try {
		  RandomPlacesExtractor extractor  = new RandomPlacesExtractor(file_path);
		  fail("should throw AssertionError");
		} catch (AssertionError e) {
			//ok here
		}
	}
	
	public void testRandomFuzzIncorrectPlace2() {
		String file_path = "./testfiles/sketch/ounit/fuzz/IncorrectFuzz1.java";
		try {
		  RandomPlacesExtractor extractor  = new RandomPlacesExtractor(file_path);
		  fail("should throw AssertionError");
		} catch (AssertionError e) {
			//ok here
		}
	}
	
	public void testRandomFuzzIncorrectPlace3() {
		String file_path = "./testfiles/sketch/ounit/fuzz/IncorrectFuzz2.java";
		try {
		  RandomPlacesExtractor extractor  = new RandomPlacesExtractor(file_path);
		  fail("should throw AssertionError");
		} catch (AssertionError e) {
			//ok here
		}
	}
	
	public void testRandomFuzzCorrectFuzz() {
		String file_path = "./testfiles/sketch/ounit/fuzz/CorrectFuzzIf.java";
		RandomPlacesExtractor extractor  = new RandomPlacesExtractor(file_path);
		assertTrue(extractor.getExprMap().size() == 1);
	}
	
}
